package com.chhuang.ewcrm.utils;

import java.io.File;

/**
 * @author chhuang
 * @create 2020-10-11-9:21
 */
public class MyPath {
    private MyPath(){}

    //dll文件目录地址一定要用\\分隔符
    //= "E:\\workspace\\ewcrm\\ewcrm-fx\\libraries\\";
    public static String PATH ;

    static{
        String p = MyPath.class.getProtectionDomain().getCodeSource().getLocation().getPath();

        if(p.contains(".jar")){
            p = p.substring(0, p.lastIndexOf("/")+1);
        }else {
            p = p.replace("target/classes/", "");
        }

        if(System.getProperty("os.name").contains("dows")){
            p = p.substring(1,p.length()).replaceAll("/", "\\\\");
        }
        PATH = p;
    }

    /**
     * 获取配置文件地址
     * @return
     */
    public static String getConfigPath(){
        return PATH+"resources"+ File.separator+"config"+File.separator;
    }

    /**
     * 获取dll文件目录
     * @return
     */
    public static String getDLLPath(){
        return PATH+"resources"+ File.separator+"libraries"+ File.separator;
    }

    /**
     * 获取抓拍图片保存地址
     * @return
     */
    public static String getCapturePicPath(){
        return PATH+"CapturePic"+ File.separator;
    }

    /**
     * 获取磅单打印模板地址
     * @return
     */
    public static String getJasperPath(){
        return PATH+"resources"+ File.separator+"reports"+File.separator;
    }
}
